package com.zeny.coding.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * <h2>分页信息</h2>
 * @Author Zeny
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageDto<T> {

    /**当前页*/
    private Integer page;

    /**每页记录数*/
    private Integer size;

    /**总条数*/
    private Long total;

    /**数据*/
    private List<T> list;

    public void check(){
        if (this.page == null || this.page < 1) {
            this.page = 1;
        }
        if (this.size == null || this.size < 1) {
            this.size = 10;
        }
    }
}
